<template>
  <!--市场端口的学校子组件-->
  <div>
    <div class="table-head-search"></div>
    <div class="table-head-content">当前结果：线索共计<span style="color: rgb(82,149,231);" v-text="schoolTotal"></span>条</div>
    <div class="content">
      <el-table :data="tschoolList" stripe>
        <el-table-column prop="schoolName" label="学校名称"></el-table-column>
        <el-table-column prop="schoolAddress" label="学校地址"></el-table-column>
        <el-table-column prop="life" label="学制" width="100px"></el-table-column>
        <el-table-column prop="type" label="类型" width="100px"></el-table-column>
        <el-table-column prop="userId" label="创建人"></el-table-column>
        <el-table-column prop="createTime" label="创建时间"></el-table-column>
        <el-table-column prop="isUsed" label="状态" width="100px"></el-table-column>
      </el-table>
      <div class="table-page">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                       background
                       layout="total, sizes, prev, pager, next, jumper"
                       :page-sizes="[10, 20, 30, 40, 50]"
                       :page-size="10"
                       :total="schoolTotal">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "School",
    created() {
      this.schoolList()
    },
    data() {
      return {
        params: {
          'pageNum': 1,
          'pageSize': 10
        },
        tschoolList: [],
        schoolTotal: 0,
      }
    },
    methods: {
      async schoolList() {
        const {data: schoolList} = await this.$http({
          headers: {
            'Content-Type': 'application/json'
          },
          method: 'post',
          url: 'http://localhost:9002/school/client/queryList',
          data: JSON.stringify(this.params)
        })
        this.tschoolList = schoolList.queryList
        this.schoolTotal = schoolList.totalCount
      },
      handleSizeChange(event) {
        console.log(event)
      },
      handleCurrentChange(event) {
        console.log(event)
      },
    }
  }
</script>

<style scoped>

</style>
